package com.yuji.aacar.core.cores.services;


import com.yuji.aacar.core.mvvm.apptask.TaskToken;
import com.yuji.aacar.net.bean.HttpCoreResultHeader;

/**
 * <li>Package:com.ttp.core.cores.services
 * <li>Author: lining
 * <li>Date: 2017/2/14
 * <li>Description: 服务返回结果类:对服务层处理结果进行包装,供UI层使用
 */

public class CoreServiceResponse<T> {

    // 返回码(200)
    private int resultCode;
    //网络请求绑定token
    private TaskToken tokenObj;
    // UI层实际使用的封装对象和返回结果 bean对象
    private T response;
    // 头数据对象
    private HttpCoreResultHeader header;
    // 操作码 与接口相关
    private int requestCode;
    // 返回码 描述
    private String message;

    public TaskToken getTokenObj() {
        return tokenObj;
    }

    public void setTokenObj(TaskToken md) {
        tokenObj = md;
    }

    public int getResultCode() {
        return resultCode;
    }

    public void setResultCode(int resultCode) {
        this.resultCode = resultCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getRequestCode() {
        return requestCode;
    }

    public void setRequestCode(int requestCode) {
        this.requestCode = requestCode;
    }

    public T getResponse() {
        return response;
    }

    public void setResponse(T response) {
        this.response = response;
    }

    public HttpCoreResultHeader getHeader() {
        return header;
    }

    public void setHeader(HttpCoreResultHeader header) {
        this.header = header;
    }

    /**
     * 默认值
     */
    private final int Default_Service_Code = CoreServiceMediator.Service_Return_Error;
    private final String Default_Service_Message = CoreServiceMediator.Service_Return_Error_Desc;

    /**
     * 构造函数
     */
    public CoreServiceResponse() {
        this.resultCode = Default_Service_Code;
        this.message = Default_Service_Message;
    }

    @Override
    public String toString() {
        return "CoreServiceResponse{" +
                "resultCode=" + resultCode +
                ", tokenObj=" + tokenObj +
                ", response=" + response +
                ", header=" + header +
                ", requestCode='" + requestCode + '\'' +
                ", message='" + message + '\'' +
                ", Default_Service_Code=" + Default_Service_Code +
                ", Default_Service_Message='" + Default_Service_Message + '\'' +
                '}';
    }
}
